
package com.smallrig.extension.dto;


public class BizSceneWrapper {
    
    private String extensionName;
    private String uniqueIdentity;


    private Class extensionClass;
    private BizScene bizScenario;

    public Class getExtensionClass() {
        return extensionClass;
    }

    public BizScene getBizScenario() {
        return bizScenario;
    }

    public static BizSceneWrapper valueOf(Class extPtClass, BizScene bizScenario){
        return new BizSceneWrapper(extPtClass, bizScenario);
    }

    public BizSceneWrapper(Class extPtClass, BizScene bizScenario){
        this.extensionClass = extPtClass;
        this.extensionName = extPtClass.getName();
        this.bizScenario = bizScenario;
        this.uniqueIdentity = bizScenario.getUniqueIdentity();
    }

    /**
     * @param extensionPoint
     * @param bizScenarioUniqueIdentity
     */
    public BizSceneWrapper(String extensionPoint, String bizScenarioUniqueIdentity){
        this.extensionName = extensionPoint;
        this.uniqueIdentity = bizScenarioUniqueIdentity;
    }

    public String getExtensionName() {
        return extensionName;
    }
    public String getUniqueIdentity() {
        return uniqueIdentity;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((uniqueIdentity == null) ? 0 : uniqueIdentity.hashCode());
        result = prime * result + ((extensionName == null) ? 0 : extensionName.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        BizSceneWrapper other = (BizSceneWrapper) obj;
        if (uniqueIdentity == null) {
            if (other.uniqueIdentity != null) return false;
        } else if (!uniqueIdentity.equals(other.uniqueIdentity)) return false;
        if (extensionName == null) {
            if (other.extensionName != null) return false;
        } else if (!extensionName.equals(other.extensionName)) return false;
        return true;
    }

    @Override
    public String toString() {
        return "ExtensionCoordinate [extensionPointName=" + extensionName + ", bizScenarioUniqueIdentity=" + uniqueIdentity + "]";
    }


}
